package domain

import (
	"context"
	"time"
)

type Item struct {
	Code             string
	Name             string
	FullName         string
	PriceArea        int32
	Brand            int32
	Status           int8
	MarketPrice      int32
	CostPrice        int32
	CustomCombo      int8
	CanSeparate      int8
	CheckedWithItem  string
	SexLimit         int8
	ChildItem        string
	RejectItem       string
	TestQtyDesc      string
	TestQty          float32
	StorageCondition string
	TestMethod       string
	ReportTimeDesc   string
	Consumable       string
	EmptyStomach     int8
	Significance     string
	CategoryId       int32
	CreatedAt        time.Time
	UpdatedAt        time.Time
}

type SearchItemList struct {
	Keywords  string
	Code      string
	Brand     int32
	PriceArea int32
	Status    int8
	PageSize  int32
	PageNo    int32
}

type ItemUsecase interface {
	ListItems(ctx context.Context, search *SearchItemList) ([]*Item, int32, error)
	GetItem(ctx context.Context, code string, brand, priceArea int32, fields []string) (*Item, error)
	CreateItem(ctx context.Context, do *Item) (*Item, error)
	UpdateItem(ctx context.Context, do *Item, mask []string) (*Item, error)
	DeleteItem(ctx context.Context, code string, brand, priceArea int32) error
	GetItems(ctx context.Context, code []string, brand, priceArea int32, fields []string) ([]*Item, error)
}

type ItemRepo interface {
	ListItems(ctx context.Context, search *SearchItemList) ([]*Item, int32, error)
	GetItem(ctx context.Context, code string, brand, priceArea int32, fields []string) (*Item, error)
	CreateItem(ctx context.Context, do *Item) (*Item, error)
	UpdateItem(ctx context.Context, do *Item, mask []string) (*Item, error)
	DeleteItem(ctx context.Context, code string, brand, priceArea int32) error
	GetItems(ctx context.Context, code []string, brand, priceArea int32, fields []string) ([]*Item, error)
}
